@extends('backstage.layout.master')
@section('title', '主题列表')
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>
            <li>
                <a href="backstage/module/module-list">模块管理</a>
            </li>
            <li class="active">
                主题列表
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="page-header">
            <h1>
                模块管理
                <small>
                    <i class="icon-double-angle-right"></i>
                    主题列表
                </small>
            </h1>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <form class="form-horizontal" role="form" action="backstage/module/add-data" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
                    <input type="hidden" name="find_module_id" value="{{$find_module_id}}">
                    <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th class="center">
                                <label>
                                    <input type="checkbox" class="ace">
                                    <span class="lbl"></span>
                                </label>
                            </th>
                            <th>主题ID</th>
                            <th>主题名称</th>
                            <th>主题背景</th>
                        </tr>
                        </thead>

                        <tbody>
                        @foreach ($types as $type)
                        <tr class="" data-tr-id="{{$type->type_id}}">
                            <td class="center">
                                <label>
                                    <input type="checkbox" class="ace" name="data_ids[]" value="{{$type->type_id}}">
                                    <span class="lbl"></span>
                                </label>
                            </td>
                            <td>{{$type->type_id}}</td>
                            <td>
                                {{$type->type_name}}
                            </td>
                            <td>
                                <img src="{{$type->type_image}}">
                            </td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                    <div class="clearfix form-actions">
                        <div class="col-md-offset-5">
                            <button class="btn btn-info" type="submit">
                                <i class="icon-ok bigger-110"></i>
                                添加
                            </button>
                        </div>
                    </div>
                </form>
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')
    <script type="text/javascript">
        $(function () {
            $('[data-rel=tooltip]').tooltip();
            $('table th input:checkbox').on('click' , function(){
                var that = this;
                $(this).closest('table').find('tr > td:first-child input:checkbox')
                        .each(function(){
                            this.checked = that.checked;
                            $(this).closest('tr').toggleClass('selected');
                        });

            });
        });
    </script>
@stop